<?php

class Controller_Test_Session extends Controller_Test_Abstract
{
    private $_session;

    public function init()
    {
        $this->_session = Core_Session::getInstance();
    }

    public function indexAction()
    {

        if ($this->_session->count) {
            ++$this->_session->count;
        } else {
            $this->_session->count = 1;
        }
        $this->_dump($this->_session->count);

        // set
        echo '<h1>set</h1>';
        $this->_session['abc']      = uniqid();
        $this->_session->xyz        = uniqid();
        $this->_session->set('ddd', uniqid());

        // get
        echo '<h1>get</h1>';
        $this->_dump($this->_session['abc']) . '<br />';
        $this->_dump($this->_session->abc) . '<br />';
        $this->_dump($this->_session->get('abc'));

        $this->_dump($this->_session['xyz']);
        $this->_dump($this->_session->xyz);
        $this->_dump($this->_session->get('xyz'));

        $this->_dump($this->_session['ddd']);
        $this->_dump($this->_session->ddd);
        $this->_dump($this->_session->get('ddd'));

        // delete
        echo '<h1>delete</h1>';
        //unset($this->_session['abc']);
        //unset($this->_session->xyz);
        //$this->_session->del('ddd');

        // foreach
        echo '<h1>foreach</h1>';
        foreach ($this->_session as $key => $value) {
            echo 'key: ' , $key, ', value: ', $value, '<br />';
        }

        // print
        echo '<h1>print</h1>';
        echo $this->_session;

        // count
        echo '<h1>count</h1>';
        echo "Session Count : " . count($this->_session);

        return false;
    }

}